// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_c.p_b;

import com.nnee.p_c.p_a.cls_d;
import com.nnee.p_fk.p_a.*;
import java.io.UnsupportedEncodingException;
import java.util.*;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.entity.ByteArrayEntity;

// Referenced classes of package com.nnee.c.b:
//            a, b, d

public class cls_c extends cls_m
{

    public cls_c(String s, com.nnee.p_c.p_b.cls_d d1)
    {
        this(s, com.nnee.p_fk.p_a.cls_b.aGET, d1);
    }

    public cls_c(String s, com.nnee.p_fk.p_a.cls_b b1, com.nnee.p_c.p_b.cls_d d1)
    {
        super(s, b1);
        h = 0;
        d = d1;
        b("Accept-Encoding", "gzip,deflate");
    }

    protected static String a(String s, String s1, List list)
    {
        return (new StringBuilder()).append(com.nnee.p_c.p_b.cls_a.a(s.toUpperCase())).append('&').append(com.nnee.p_c.p_b.cls_a.a(com.nnee.p_c.p_b.cls_a.d(s1))).append('&').append(com.nnee.p_c.p_b.cls_a.a(b(list))).toString();
    }

    private String a(List list)
    {
        StringBuilder stringbuilder = new StringBuilder();
        stringbuilder.append("OAuth");
        if(1 != h)
        {
            String s1 = com.nnee.p_c.p_b.cls_a.d(super.b());
            if(s1 != null)
            {
                stringbuilder.append(" realm=\"").append(com.nnee.p_c.p_b.cls_a.a(s1)).append('"');
                stringbuilder.append(",");
            }
        }
        LinkedList linkedlist = new LinkedList();
        for(int i = 0; i < list.size(); i++)
        {
            com.nnee.p_c.p_b.cls_b b1 = (com.nnee.p_c.p_b.cls_b)list.get(i);
            String s = b1.getName();
            if(!s.startsWith("oauth_"))
                continue;
            if(i > 0)
                stringbuilder.append(",");
            stringbuilder.append(" ");
            stringbuilder.append(com.nnee.p_c.p_b.cls_a.a(s)).append("=\"");
            stringbuilder.append(com.nnee.p_c.p_b.cls_a.a(b1.getValue()));
            stringbuilder.append('"');
            linkedlist.add(b1);
        }

        list.removeAll(linkedlist);
        return stringbuilder.toString();
    }

    private static String b(List list)
    {
        Collections.sort(list);
        StringBuilder stringbuilder = new StringBuilder();
        for(Iterator iterator = list.iterator(); iterator.hasNext(); stringbuilder.append('&'))
        {
            com.nnee.p_c.p_b.cls_b b1 = (com.nnee.p_c.p_b.cls_b)iterator.next();
            stringbuilder.append(com.nnee.p_c.p_b.cls_a.a(b1.getName()));
            stringbuilder.append("=");
            stringbuilder.append(com.nnee.p_c.p_b.cls_a.a(b1.getValue()));
        }

        stringbuilder.deleteCharAt(-1 + stringbuilder.length());
        return stringbuilder.toString();
    }

    public void a()
    {
        ArrayList arraylist;
        com.nnee.p_fk.p_a.cls_b b1;
        arraylist = new ArrayList();
        List list = k();
        if(list != null)
        {
            cls_h h1;
            for(Iterator iterator = list.iterator(); iterator.hasNext(); arraylist.add(new com.nnee.p_c.p_b.cls_b(h1.a(), h1.b())))
                h1 = (cls_h)iterator.next();

        }
        if(d.d != null)
            arraylist.add(new com.nnee.p_c.p_b.cls_b("oauth_token", d.d));
        arraylist.add(new com.nnee.p_c.p_b.cls_b("oauth_consumer_key", d.a));
        arraylist.add(new com.nnee.p_c.p_b.cls_b("oauth_signature_method", d.a()));
        arraylist.add(new com.nnee.p_c.p_b.cls_b("oauth_version", "1.0"));
        arraylist.add(new com.nnee.p_c.p_b.cls_b("oauth_timestamp", String.valueOf(System.currentTimeMillis() / 1000L)));
        arraylist.add(new com.nnee.p_c.p_b.cls_b("oauth_nonce", String.valueOf(System.currentTimeMillis() + Math.abs(c.nextLong()))));
        String s = a(o().toString(), super.b(), ((List) (arraylist)));
        arraylist.add(new com.nnee.p_c.p_b.cls_b("oauth_signature", d.b().a(s)));
        b1 = o();
        String s1;
        
        if(b1 !=  com.nnee.p_fk.p_a.cls_b.bPOST && b1 !=  com.nnee.p_fk.p_a.cls_b.dDELETE && b1 != com.nnee.p_fk.p_a.cls_b.cPUT) 
        {
        	
        } else {
        	 if(!f || p() != null)
                 return ;
             s1 = b(arraylist);
             byte abyte1[]=null;
			try {
				abyte1 = s1.getBytes("utf-8");
			} catch (UnsupportedEncodingException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
             byte abyte0[] = abyte1;
             
             b("Content-Type", "application/x-www-form-urlencoded");
             a(((org.apache.http.HttpEntity) (new ByteArrayEntity(abyte0))));
             arraylist.clear();
        }
        
        if(arraylist.size() > 0)
            e = (new StringBuilder()).append(super.b()).append("?").append(URLEncodedUtils.format(arraylist, "UTF-8")).toString();
        else
            e = super.b();
        return;
//_L1:
//        
//        if(!f || p() != null)
//            break MISSING_BLOCK_LABEL_424;
//        s1 = b(arraylist);
//        byte abyte1[] = s1.getBytes("utf-8");
//        byte abyte0[] = abyte1;
//_L3:
//        b("Content-Type", "application/x-www-form-urlencoded");
//        a(((org.apache.http.HttpEntity) (new ByteArrayEntity(abyte0))));
//        arraylist.clear();
//_L2:
//        UnsupportedEncodingException unsupportedencodingexception;
//        if(arraylist.size() > 0)
//            e = (new StringBuilder()).append(super.b()).append("?").append(URLEncodedUtils.format(arraylist, "UTF-8")).toString();
//        else
//            e = super.b();
//        return;
//        unsupportedencodingexception;
//        abyte0 = s1.getBytes();
//          goto _L3
//        if(!g)
//        {
//            b("Authorization", a(((List) (arraylist))));
//            arraylist.clear();
//        }
//          goto _L2
    }

    public void a(int i)
    {
        h = i;
    }

    public void a(boolean flag)
    {
        f = flag;
    }

    public String b()
    {
        return e;
    }

    public void b(boolean flag)
    {
        g = flag;
    }

    public static final int a = 0;
    public static final int b = 1;
    protected static Random c = new Random();
    protected com.nnee.p_c.p_b.cls_d d;
    protected String e;
    boolean f;
    boolean g;
    int h;

}
